Skip to content

Refactor scala.quoted.matching #8479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 9, 2020

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Mar 9, 2020

Importing scala.quoted._ should give access to all the basic functionalities, but currently some half of them need the extra import for scala.quoted.matching._.

  • Move scala.quoted.matching.summonExpr to scala.quoted.Expr.summon
  • Move basic quote extractors from scala.quoted.matching to scala.quoted
  • Join literal sequence Expr logic into Varargs (Expr.ofSeq and ExprSeq.unapply)
  • Add Consts and Values. Then remove ConstSeq and ValueSeq

Importing `scala.quoted._` should give access to all the basic functionalities, but currently some half of them need the extra import for `scala.quoted.matching._`.

* Move `scala.quoted.matching.summonExpr` to `scala.quoted.Expr.summon`
* Move basic quote extractors from `scala.quoted.matching` to `scala.quoted`
@nicolasstucki nicolasstucki requested a review from liufengyun March 9, 2020 08:59
@nicolasstucki nicolasstucki self-assigned this Mar 9, 2020
@nicolasstucki nicolasstucki marked this pull request as ready for review March 9, 2020 09:37
Currently we have `Expr.ofSeq` and `ExprSeq.unapply` to handle such cases.
Instead we provide a single `Exprs` that contains an `apply` and `unapply`.

Furthermore having both `Expr.ofSeq` and `Expr.ofList` has lead to confusions on which one to use for varargs.
This will help guide users to the correct logic to use for varargs.
Instead of having a special concept to extract values out of sequences,
with this change, we can take advantage of composition with `Exprs`.

The old `ConstSeq` and `ValueSeq` are deprecated to reduce the sumber of concepts in the API.
@nicolasstucki nicolasstucki force-pushed the refactor-quoted-matching branch from 1a94411 to be3f2d7 Compare March 9, 2020 12:18
Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@anatoliykmetyuk anatoliykmetyuk added this to the 0.23.0-RC1 milestone Mar 9, 2020
@nicolasstucki nicolasstucki merged commit bb52aa8 into scala:master Mar 9, 2020
@nicolasstucki nicolasstucki deleted the refactor-quoted-matching branch March 9, 2020 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants